 package org.spring.boot.fusion.sender;

import org.springframework.amqp.core.Binding;
import org.springframework.amqp.core.BindingBuilder;
import org.springframework.amqp.core.DirectExchange;
import org.springframework.amqp.core.FanoutExchange;
import org.springframework.amqp.core.Queue;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

@Configuration
public class SenderConf {
	/**********一对一****************/
	@Bean
	public Queue queue() {
		return new Queue("queue");
	}
	
	/**********交换机1-接受所有的数据****************/
	
	@Bean
    public FanoutExchange fanoutExchange() {
        return new FanoutExchange("zhaoyan");
    }
	
	@Bean
	public Queue queue1() {
		return new Queue("spring-queue");
	}

	@Bean
	public Queue queue2() {
		return new Queue("spring-queue2");
	}
	
    @Bean
    Binding bindingExchangeA() {
        return BindingBuilder.bind(queue1()).to(fanoutExchange());
    }
 
    @Bean
    Binding bindingExchangeB() {
        return BindingBuilder.bind(queue2()).to(fanoutExchange());
    }
 
    
	@Bean
    public DirectExchange directExchange() {
        return new DirectExchange("zhaoyan2");
    }
	
    @Bean
    Binding bindingExchangeC() {
        return BindingBuilder.bind(queue2()).to(directExchange()).with("insert");
    }
    
    @Bean
    Binding bindingExchangeD() {
        return BindingBuilder.bind(queue1()).to(directExchange()).with("updata");
    }
	
	
	
	
}